import sys
sys.path.append("/Users/johnmyers/dev/johnmyers-phd/teaching/aux-files")
import numpy as np
from plotting import plot_curve_animation, plot_surface
L = 10
blue = "#3399FF"
def u(x, t, n):
return np.sin(n * np.pi * x / L) * np.cos(n * np.pi * t / L)
def u1(x, t):
return u(x, t, 1)
x = np.linspace(0, L, 100)
t = np.linspace(0, 2 * L, 100)
plot_curve_animation(
functions=[u1],
colors=[blue],
title="Harmonic n=1",
x_vals=x,
y_vals=[-2, 2],
t_vals=t,
x_axis_label="x = position",
y_axis_label="u(x,t) = displacement",
)